package com.zrgj.ctrl;

import com.zrgj.entity.Stock;
import com.zrgj.services.StockServiceInpl;
import com.zrgj.vo.JsonResult;
import com.zrgj.vo.StockVO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class StockController {

    @Resource
    private StockServiceInpl stockServiceInpl;

    @PostMapping("/mgr/stock")
    public JsonResult add(@RequestBody StockVO stock){
        JsonResult jr=new JsonResult(0,"添加成功！");



        try {
            List list=stockServiceInpl.query(stock);
            jr.setData(list);
        } catch (Exception throwables) {
            jr.setCode(2);
            jr.setMsg("服务器发生错误！");
            throwables.printStackTrace();
        }
        return jr;
    }

}
